<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>$.ajax方法基本使用</title>
</head>
<body>
	<button id="btn">发送请求</button>
	<script src="/js/jquery.min.js"></script>
	<script>
		var params = {name:'wangwu',age:300}
		$('#btn').on('click',function(){
			$.ajax({
				type:'post',
				url:'/user',
				// data:{
				// 	name:'zhangsan',
				// 	age:100
				// },
				data:JSON.stringify(params),
				//指定参数的格式类型
				contentType:'application/json',
				success:function(response){
					console.log(response);
				}
			})
		})
	</script>
</body>
</html>